package cn.yy.cloudpay.activity;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;

import cn.yy.cloudpay.view.ToastUtil;

public class BaseActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		//拦截多任务键
		getWindow().addFlags(5);
		getWindow().addFlags(3); // 拦截Home键
//		Log.d("TAG", "BaseActivity----onCreate");
	}

	@Override
	protected void onStart() {
		super.onStart();
//		Log.d("TAG", "BaseActivity----onStart");
	}

	@Override
	protected void onRestart() {
		super.onRestart();
//		Log.d("TAG", "BaseActivity----onRestart");
	}

	@Override
	protected void onResume() {
		super.onResume();
		//获取操作员信息
//		Log.d("TAG", "BaseActivity----onResume");
	}

	@Override
	protected void onPause() {
		super.onPause();
//		Log.d("TAG", "BaseActivity----onPause");
	}

	@Override
	protected void onStop() {
		super.onStop();
//		Log.d("TAG", "BaseActivity----onStop");
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
//		Log.d("TAG", "BaseActivity----onDestroy");
	}

	@Override
	public void onBackPressed() {
		super.onBackPressed();
//		Log.d("TAG", "BaseActivity----onBackPressed");
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_HOME) {
			return false;
		}
		//退出程序
		return super.onKeyDown(keyCode, event);
	}

	public boolean isDeviceInit() {
		return false;
	}

	public int getResource(String imageName) {
		Context ctx = getBaseContext();
		int resId = getResources().getIdentifier(imageName, "drawable", ctx.getPackageName());
		return resId;
	}
}
